package com.wing.product.strategy;

import com.wing.sell.model.response.OrderSkuDetailSearchVo;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description: 实现抽象类中规定的订单流程的具体步骤，通过工厂获取实际的订单策略class，通过BeansUtil返回spring容器中的策略实现类bean
 * @Project: szgc-enterprise-coding
 * @Package: com.wing.sell.strategy.SelOrderGenerateServiceImpl
 * @Date: 2024/12/16 10:52
 * @Author: heZhou
 * @Version: 1.0
 */
@Component
public class OrderTServiceImpl extends AbstractTOrderService {

    /**
     * 订单类型
     * @param type 类型
     * @return
     */
    @Override
    public boolean isGenerateOrder(String type) {
        OrderTStrategy strategy = OrderTStrategyFactory.getStrategy(this.orderType);
        if (strategy == null) {
            return false;
        }
        return true;
    }

    /**
     * 获取物料详情
     * @param orderId 订单id
     * @return
     */
    @Override
    public List<OrderSkuDetailSearchVo> getDetailBy(Long orderId) {
        OrderTStrategy strategy = OrderTStrategyFactory.getStrategy(this.orderType);
        if (strategy != null) {
            return strategy.getDetailBy(orderId);
        }
        return null;
    }
}
